Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

find-node.sh supports Homebrew on M1 #31622

Closed
wants to merge 2 commits into from

Conversation

dulmandakh
Copy link
Contributor

@dulmandakh dulmandakh commented May 28, 2021

Summary

Homebrew on M1 installs executable binaries in /opt/homebrew/bin (See https://brew.sh/2021/02/05/homebrew-3.0.0/), and FBReactNativeSpec.build is failing because it couldn't find node. This PR changes find-node.sh script to add /opt/homebrew/bin into $PATH.

The way react.gradle trying to execute node is not using user environment variables, but system defaults, so it couldn't find it. I removed node execution, and hard coded cli path in parity with iOS

[ -z "$CLI_PATH" ] && export CLI_PATH="$REACT_NATIVE_DIR/cli.js"

Fixes #31621 #31592

Changelog

[General] [Changed] - find-node.sh supports Homebrew on M1

Test Plan

On M1, create a RN project and it'll fail to build iOS app. Apply the patch, and build will succeed.

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Contributor A React Native contributor. labels May 28, 2021
@dulmandakh
Copy link
Contributor Author

@kelset should we cherry pick this to 0.64?

@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
ios - universal n/a --

Base commit: 118489f

@kelset
Copy link
Contributor

kelset commented Jun 1, 2021

@kelset should we cherry pick this to 0.64?

yeah that's a good idea, we need to get this merged first thought 😓

@facebook-github-bot
Copy link
Contributor

@hramos has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@hramos merged this pull request in 502b819.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Jun 2, 2021
kelset pushed a commit that referenced this pull request Jun 3, 2021
Summary:
Homebrew on M1 installs executable binaries in **/opt/homebrew/bin** (See https://brew.sh/2021/02/05/homebrew-3.0.0/), and FBReactNativeSpec.build is failing because it couldn't find node. This PR changes find-node.sh script to add /opt/homebrew/bin into $PATH.

The way **react.gradle** trying to execute node is not using user environment variables, but system defaults, so it couldn't find it. I removed node execution, and hard coded cli path in parity with iOS https://github.com/facebook/react-native/blob/d1ab03235cb4b93304150878d2b9057ab45bba77/scripts/react-native-xcode.sh#L106

Fixes #31621 #31592

## Changelog

[General] [Changed] - find-node.sh supports Homebrew on M1

Pull Request resolved: #31622

Test Plan: On M1, create a RN project and it'll fail to build iOS app. Apply the patch, and build will succeed.

Reviewed By: ShikaSD

Differential Revision: D28808206

Pulled By: hramos

fbshipit-source-id: 8b313b6685462a15e67d99c61a0202d17fece1ec

# Conflicts:
#	scripts/find-node.sh
Titozzz pushed a commit to Titozzz/react-native that referenced this pull request Jun 7, 2021
Summary:
Homebrew on M1 installs executable binaries in **/opt/homebrew/bin** (See https://brew.sh/2021/02/05/homebrew-3.0.0/), and FBReactNativeSpec.build is failing because it couldn't find node. This PR changes find-node.sh script to add /opt/homebrew/bin into $PATH.

The way **react.gradle** trying to execute node is not using user environment variables, but system defaults, so it couldn't find it. I removed node execution, and hard coded cli path in parity with iOS https://github.com/facebook/react-native/blob/d1ab03235cb4b93304150878d2b9057ab45bba77/scripts/react-native-xcode.sh#L106

Fixes facebook#31621 facebook#31592

## Changelog

[General] [Changed] - find-node.sh supports Homebrew on M1

Pull Request resolved: facebook#31622

Test Plan: On M1, create a RN project and it'll fail to build iOS app. Apply the patch, and build will succeed.

Reviewed By: ShikaSD

Differential Revision: D28808206

Pulled By: hramos

fbshipit-source-id: 8b313b6685462a15e67d99c61a0202d17fece1ec
Titozzz pushed a commit to Titozzz/react-native that referenced this pull request Jun 7, 2021
Summary:
Homebrew on M1 installs executable binaries in **/opt/homebrew/bin** (See https://brew.sh/2021/02/05/homebrew-3.0.0/), and FBReactNativeSpec.build is failing because it couldn't find node. This PR changes find-node.sh script to add /opt/homebrew/bin into $PATH.

The way **react.gradle** trying to execute node is not using user environment variables, but system defaults, so it couldn't find it. I removed node execution, and hard coded cli path in parity with iOS https://github.com/facebook/react-native/blob/d1ab03235cb4b93304150878d2b9057ab45bba77/scripts/react-native-xcode.sh#L106

Fixes facebook#31621 facebook#31592

## Changelog

[General] [Changed] - find-node.sh supports Homebrew on M1

Pull Request resolved: facebook#31622

Test Plan: On M1, create a RN project and it'll fail to build iOS app. Apply the patch, and build will succeed.

Reviewed By: ShikaSD

Differential Revision: D28808206

Pulled By: hramos

fbshipit-source-id: 8b313b6685462a15e67d99c61a0202d17fece1ec
@danilobuerger
Copy link
Contributor

@dulmandakh sadly this fix is incorrect when using nvm on m1. The order in find-node.sh is wrong. If you put the HOMEBREW_M1_BIN code at the top then the command -v brew will be able to find homebrew and source the nvm script.

@dulmandakh
Copy link
Contributor Author

dulmandakh commented Jun 7, 2021

Sorry, I don't use nvm and have no experience, also didn't wanted to mess with someones setup. Please create a PR, I would be happy to review it. Thanks

tido64 pushed a commit that referenced this pull request Jun 8, 2021
Summary:
Homebrew on M1 installs executable binaries in **/opt/homebrew/bin** (See https://brew.sh/2021/02/05/homebrew-3.0.0/), and FBReactNativeSpec.build is failing because it couldn't find node. This PR changes find-node.sh script to add /opt/homebrew/bin into $PATH.

The way **react.gradle** trying to execute node is not using user environment variables, but system defaults, so it couldn't find it. I removed node execution, and hard coded cli path in parity with iOS https://github.com/facebook/react-native/blob/d1ab03235cb4b93304150878d2b9057ab45bba77/scripts/react-native-xcode.sh#L106

Fixes #31621 #31592

## Changelog

[General] [Changed] - find-node.sh supports Homebrew on M1

Pull Request resolved: #31622

Test Plan: On M1, create a RN project and it'll fail to build iOS app. Apply the patch, and build will succeed.

Reviewed By: ShikaSD

Differential Revision: D28808206

Pulled By: hramos

fbshipit-source-id: 8b313b6685462a15e67d99c61a0202d17fece1ec
facebook-github-bot pushed a commit that referenced this pull request Jun 8, 2021
Summary:
Adds homebrew on m1 to path before evaluating `command -v brew` to support nvm on m1 via homebrew.

## Changelog

[General] [Changed] - Find node on m1 via homebrew node managers

Pull Request resolved: #31678

Test Plan:
On M1, use nvm via homebrew. Create a RN project and it'll fail to build iOS app. Apply the patch, and build will succeed.

cc: dulmandakh as discussed in #31622

Reviewed By: ShikaSD

Differential Revision: D28967386

Pulled By: PeteTheHeat

fbshipit-source-id: 3d4a41dd3cc25fbf77778b16468a236b141d1259
danilobuerger pushed a commit to feastr/react-native that referenced this pull request Jun 9, 2021
Summary:
Homebrew on M1 installs executable binaries in **/opt/homebrew/bin** (See https://brew.sh/2021/02/05/homebrew-3.0.0/), and FBReactNativeSpec.build is failing because it couldn't find node. This PR changes find-node.sh script to add /opt/homebrew/bin into $PATH.

The way **react.gradle** trying to execute node is not using user environment variables, but system defaults, so it couldn't find it. I removed node execution, and hard coded cli path in parity with iOS https://github.com/facebook/react-native/blob/d1ab03235cb4b93304150878d2b9057ab45bba77/scripts/react-native-xcode.sh#L106

Fixes facebook#31621 facebook#31592

[General] [Changed] - find-node.sh supports Homebrew on M1

Pull Request resolved: facebook#31622

Test Plan: On M1, create a RN project and it'll fail to build iOS app. Apply the patch, and build will succeed.

Reviewed By: ShikaSD

Differential Revision: D28808206

Pulled By: hramos

fbshipit-source-id: 8b313b6685462a15e67d99c61a0202d17fece1ec
danilobuerger added a commit to feastr/react-native that referenced this pull request Jun 9, 2021
Summary:
Adds homebrew on m1 to path before evaluating `command -v brew` to support nvm on m1 via homebrew.

## Changelog

[General] [Changed] - Find node on m1 via homebrew node managers

Pull Request resolved: facebook#31678

Test Plan:
On M1, use nvm via homebrew. Create a RN project and it'll fail to build iOS app. Apply the patch, and build will succeed.

cc: dulmandakh as discussed in facebook#31622

Reviewed By: ShikaSD

Differential Revision: D28967386

Pulled By: PeteTheHeat

fbshipit-source-id: 3d4a41dd3cc25fbf77778b16468a236b141d1259
kelset pushed a commit that referenced this pull request Jun 16, 2021
Summary:
Adds homebrew on m1 to path before evaluating `command -v brew` to support nvm on m1 via homebrew.

## Changelog

[General] [Changed] - Find node on m1 via homebrew node managers

Pull Request resolved: #31678

Test Plan:
On M1, use nvm via homebrew. Create a RN project and it'll fail to build iOS app. Apply the patch, and build will succeed.

cc: dulmandakh as discussed in #31622

Reviewed By: ShikaSD

Differential Revision: D28967386

Pulled By: PeteTheHeat

fbshipit-source-id: 3d4a41dd3cc25fbf77778b16468a236b141d1259
Setito pushed a commit to Setito/react-native that referenced this pull request Jul 17, 2021
Summary:
Homebrew on M1 installs executable binaries in **/opt/homebrew/bin** (See https://brew.sh/2021/02/05/homebrew-3.0.0/), and FBReactNativeSpec.build is failing because it couldn't find node. This PR changes find-node.sh script to add /opt/homebrew/bin into $PATH.

The way **react.gradle** trying to execute node is not using user environment variables, but system defaults, so it couldn't find it. I removed node execution, and hard coded cli path in parity with iOS https://github.com/facebook/react-native/blob/d1ab03235cb4b93304150878d2b9057ab45bba77/scripts/react-native-xcode.sh#L106

Fixes facebook#31621 facebook#31592

## Changelog

[General] [Changed] - find-node.sh supports Homebrew on M1

Pull Request resolved: facebook#31622

Test Plan: On M1, create a RN project and it'll fail to build iOS app. Apply the patch, and build will succeed.

Reviewed By: ShikaSD

Differential Revision: D28808206

Pulled By: hramos

fbshipit-source-id: 8b313b6685462a15e67d99c61a0202d17fece1ec
danilobuerger pushed a commit to feastr/react-native that referenced this pull request Oct 28, 2021
Summary:
Homebrew on M1 installs executable binaries in **/opt/homebrew/bin** (See https://brew.sh/2021/02/05/homebrew-3.0.0/), and FBReactNativeSpec.build is failing because it couldn't find node. This PR changes find-node.sh script to add /opt/homebrew/bin into $PATH.

The way **react.gradle** trying to execute node is not using user environment variables, but system defaults, so it couldn't find it. I removed node execution, and hard coded cli path in parity with iOS https://github.com/facebook/react-native/blob/d1ab03235cb4b93304150878d2b9057ab45bba77/scripts/react-native-xcode.sh#L106

Fixes facebook#31621 facebook#31592

[General] [Changed] - find-node.sh supports Homebrew on M1

Pull Request resolved: facebook#31622

Test Plan: On M1, create a RN project and it'll fail to build iOS app. Apply the patch, and build will succeed.

Reviewed By: ShikaSD

Differential Revision: D28808206

Pulled By: hramos

fbshipit-source-id: 8b313b6685462a15e67d99c61a0202d17fece1ec
danilobuerger added a commit to feastr/react-native that referenced this pull request Oct 28, 2021
Summary:
Adds homebrew on m1 to path before evaluating `command -v brew` to support nvm on m1 via homebrew.

## Changelog

[General] [Changed] - Find node on m1 via homebrew node managers

Pull Request resolved: facebook#31678

Test Plan:
On M1, use nvm via homebrew. Create a RN project and it'll fail to build iOS app. Apply the patch, and build will succeed.

cc: dulmandakh as discussed in facebook#31622

Reviewed By: ShikaSD

Differential Revision: D28967386

Pulled By: PeteTheHeat

fbshipit-source-id: 3d4a41dd3cc25fbf77778b16468a236b141d1259
danilobuerger pushed a commit to feastr/react-native that referenced this pull request Oct 28, 2021
Summary:
Homebrew on M1 installs executable binaries in **/opt/homebrew/bin** (See https://brew.sh/2021/02/05/homebrew-3.0.0/), and FBReactNativeSpec.build is failing because it couldn't find node. This PR changes find-node.sh script to add /opt/homebrew/bin into $PATH.

The way **react.gradle** trying to execute node is not using user environment variables, but system defaults, so it couldn't find it. I removed node execution, and hard coded cli path in parity with iOS https://github.com/facebook/react-native/blob/d1ab03235cb4b93304150878d2b9057ab45bba77/scripts/react-native-xcode.sh#L106

Fixes facebook#31621 facebook#31592

[General] [Changed] - find-node.sh supports Homebrew on M1

Pull Request resolved: facebook#31622

Test Plan: On M1, create a RN project and it'll fail to build iOS app. Apply the patch, and build will succeed.

Reviewed By: ShikaSD

Differential Revision: D28808206

Pulled By: hramos

fbshipit-source-id: 8b313b6685462a15e67d99c61a0202d17fece1ec
danilobuerger added a commit to feastr/react-native that referenced this pull request Oct 28, 2021
Summary:
Adds homebrew on m1 to path before evaluating `command -v brew` to support nvm on m1 via homebrew.

## Changelog

[General] [Changed] - Find node on m1 via homebrew node managers

Pull Request resolved: facebook#31678

Test Plan:
On M1, use nvm via homebrew. Create a RN project and it'll fail to build iOS app. Apply the patch, and build will succeed.

cc: dulmandakh as discussed in facebook#31622

Reviewed By: ShikaSD

Differential Revision: D28967386

Pulled By: PeteTheHeat

fbshipit-source-id: 3d4a41dd3cc25fbf77778b16468a236b141d1259
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Contributor A React Native contributor. Merged This PR has been merged. Needs: React Native Team Attention
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The following build commands failed
6 participants